<link href="styles.css" rel="stylesheet" type="text/css" />
<?
$dbname            ='aerosnemanje'; //Name of the database
$dbuser            ='root'; //Username for the db
$dbpass            ='onebmad84'; //Password for the db
$dbserver          ='localhost'; //Name of the mysql server
 
$dbcnx = mysql_connect ("$dbserver", "$dbuser", "$dbpass");
mysql_select_db("$dbname") or die(mysql_error());

$query_izberiProjekt = "SELECT * FROM projekti";
$izberiProjekt = mysql_query($query_izberiProjekt, $dbcnx) or die(mysql_error());
$row_izberiProjekt = mysql_fetch_assoc($izberiProjekt);
$totalRows_izberiProjekt = mysql_num_rows($izberiProjekt);


$selected_projekt = $_POST['id_projekta'];
if ($selected_projekt == null) {
  $selected_projekt = 1;
  }
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>AeroPHPXML :: Grafika</title>
 <style type="text/css">
 #map {
	width: 700px;
	height: 500px;
	border: 2px solid #000000;
	padding: 0px;
	font-size: 10px;
}
 </style>
 <script src="http://maps.google.com/maps/api/js?v=3&sensor=false" type="text/javascript"></script>
 <script type="text/javascript">
 var icon = new google.maps.MarkerImage("dot_12_lightblue.png",
  new google.maps.Size(12, 12),
  new google.maps.Point(0, 0),
  new google.maps.Point(6, 6));
 var icon2 = new google.maps.MarkerImage("dot_12_lightgreen.png",
  new google.maps.Size(12, 12),
  new google.maps.Point(0, 0),
  new google.maps.Point(6, 6));
 var center = null;
 var map = null;
 var currentPopup;
 var bounds = new google.maps.LatLngBounds();
 function addMarker(lat, lng, info) {
 var pt = new google.maps.LatLng(lat, lng);
 bounds.extend(pt);
 var marker = new google.maps.Marker({
 position: pt,
 icon: icon,
 map: map
 });
 var popup = new google.maps.InfoWindow({
 content: info,
 maxWidth: 850
 });
 google.maps.event.addListener(marker, "click", function() {
 if (currentPopup != null) {
 currentPopup.close();
 currentPopup = null;
 }
 popup.open(map, marker);
 currentPopup = popup;
 });
 google.maps.event.addListener(popup, "closeclick", function() {
 map.panTo(center);
 currentPopup = null;
 });
 }
 
 function addMarker2(lat2, lng2, info2) {
 var pt2 = new google.maps.LatLng(lat2, lng2);
 bounds.extend(pt2);
 var marker2 = new google.maps.Marker({
 position: pt2,
 icon: icon2,
 map: map
 });
 var popup = new google.maps.InfoWindow({
 content: info2,
 maxWidth: 850
 });
 google.maps.event.addListener(marker2, "click", function() {
 if (currentPopup != null) {
 currentPopup.close();
 currentPopup = null;
 }
 popup.open(map, marker2);
 currentPopup = popup;
 });
 google.maps.event.addListener(popup, "closeclick", function() {
 map.panTo(center);
 currentPopup = null;
 });
 }
 
 
 
 function initMap() {
 map = new google.maps.Map(document.getElementById("map"), {
 center: new google.maps.LatLng(0, 0),
 zoom: 16,
 mapTypeId: google.maps.MapTypeId.HYBRID,
 mapTypeControl: true,
 mapTypeControlOptions: {
 style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
 },
 navigationControl: true,
 navigationControlOptions: {
 style: google.maps.NavigationControlStyle.LARGE
 }
 });
 <?php
 $query = mysql_query("SELECT * FROM tocke_geodetic WHERE IDProjekta = '$selected_projekt'");
 while ($row = mysql_fetch_array($query)){
 $name=$row['imeTocke'];
 $lat=$row['lat'];
 $lon=$row['lon'];
 $desc=$row['stReda'];
 $guideline=$row['guidelineTocka'];
 echo ("addMarker($lat, $lon,'<b>$name</b><br/>Red: $desc<br/>Lat: $lat<br/>Lon: $lon');\n");
 }
 ?>
 <?
 $query2 = mysql_query("SELECT * FROM tocke_geodetic_result WHERE IDProjekta = '$selected_projekt'");
 while ($row2 = mysql_fetch_array($query2)){
 $name2=$row2['imeTocke'];
 $lat2=$row2['lat'];
 $lon2=$row2['lon'];
 $desc2=$row2['stReda'];
 $cas2=$row2['Cas'];
 echo ("addMarker2($lat2, $lon2,'<b>$name2</b> - $cas2<br/>Red: $desc2<br/>Lat: $lat2<br/>Lon: $lon2');\n");
 }
 ?>
 center = bounds.getCenter();
 map.fitBounds(bounds);
 }
 </script>
</head>
<body onLoad="initMap()" style="margin:0px; border:1px; padding:3px;">
	<div align="left">
<span class="myhead">Prikaz točk po posameznih projektih</span><br>
<span class="table1">Grafična podlaga: Google Maps / Točke: baza 2B / Koordinatni sistem: WGS'84</span><br><br></div>
<table width="850px" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="750"><div id="map"></div></td>
    <td align="center" valign="top">
    	<form action="show_points.php" method="post" enctype="multipart/form-data">
  <label>Izberi projekt:<br />
  <select name="id_projekta" size="20" multiple class="small-font" tabindex="0">
    <?php
do {  
?>
    <option value="<?php echo $row_izberiProjekt['IDP']?>"><?php echo $row_izberiProjekt['Naziv']?></option>
    <?php
} while ($row_izberiProjekt = mysql_fetch_assoc($izberiProjekt));
  $rows = mysql_num_rows($izberiProjekt);
  if($rows > 0) {
      mysql_data_seek($izberiProjekt, 0);
	  $row_izberiProjekt = mysql_fetch_assoc($izberiProjekt);
  }
?>
  </select>
  <br />
  </label>
  <input name="Submit" type="submit" class="small-font" tabindex="1" value="Osveži" />
</form>
<br><a href="index.php">&lt;&lt; Nazaj na meni</a>
</td>
</tr>
</table>
</html>